

#include "MVPAndViewPos.glh"

layout(location = 0) in vec3 vertex;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 uv;

out ShaderData {
  vec3 worldPos;
  vec3 worldNormal;
  vec2 fragUv;
}
vs_out;

void main() {
  vec4 tempPos = modelMatrix * vec4(vertex, 1.0f);
  vec3 worldPos = vec3(tempPos);
  vec3 worldNormal =
      normalize(vec3(transpose(inverse(modelMatrix)) * vec4(normal, 1.0f)));
  gl_Position = projMatrix * viewMatrix * tempPos;
  vs_out.fragUv = uv;
  vs_out.worldNormal = worldNormal;
  vs_out.worldPos = worldPos;
}
